//
//  GuLuTableViewCell.m
//  WangI
//
//  Created by dllo on 15/11/25.
//  Copyright © 2015年 WJN. All rights reserved.
//

#import "GuLuTableViewCell.h"
#import "UIImageView+WebCache.h"
@implementation GuLuTableViewCell
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self addSubview:self.label];
        [_label release];
        [self addSubview:self.imageOne];
        [self.imageOne release];
        [self addSubview:self.imageTwo];
        [self.imageTwo release];
        [self addSubview:self.imageThree];
        [self.imageThree release];
    }
    return self;
}
-(UIImageView *)imageOne {
    if (!_imageOne) {
        self.imageOne = [[UIImageView alloc] initWithFrame:CGRectZero];
        
    }
    return _imageOne;
}
-(UIImageView *)imageTwo {
    if (!_imageTwo) {
        self.imageTwo = [[UIImageView alloc] initWithFrame:CGRectZero];
    }
    return _imageTwo;
}
-(UIImageView *)imageThree {
    if (!_imageThree) {
        self.imageThree = [[UIImageView alloc] initWithFrame:CGRectZero];
    }
    return _imageThree;
}
-(UILabel *)label {
    if (!_label) {
        self.label = [[UILabel alloc] initWithFrame:CGRectZero];
    }
    return _label;
}
-(void)setNewsModel:(NewsModel *)newsModel {
    if (_newsModel != newsModel) {
        [_newsModel release];
        _newsModel = [newsModel retain];
    }
    self.label.text = newsModel.title;
    [self.imageOne sd_setImageWithURL:[NSURL URLWithString:newsModel.imgsrc]];
    ImgextraModel *imgextra1 = newsModel.imgextraSource[0];
    [self.imageTwo sd_setImageWithURL:[NSURL URLWithString:imgextra1.imgsrc]];
    ImgextraModel *imgextra2 = newsModel.imgextraSource[1];
    [self.imageThree sd_setImageWithURL:[NSURL URLWithString:imgextra2.imgsrc]];
}
-(void)layoutSubviews {
    [super layoutSubviews];
    self.label.frame = CGRectMake(0, 0, self.frame.size.width, 20);
    self.imageOne.frame = CGRectMake(5, 20, self.frame.size.width / 3 - 5, self.frame.size.height - 20);
    self.imageTwo.frame = CGRectMake(self.frame.size.width / 3 + 5, 20, self.frame.size.width / 3 - 5,self.frame.size.height - 20);
    self.imageThree.frame =CGRectMake(self.frame.size.width / 3 * 2 + 5, 20, self.frame.size.width / 3 - 10,self.frame.size.height - 20);

}
- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
